package com.blackitheima1.LambdaDemo.test5;
//Lambda表达式 有参有返回值
public class TestAddSum {
    public static void main(String[] args) {
        //匿名内部类
       double sum=getAddSum(new AddSum() {
            @Override
            public double addS(double x, double y) {
                return x+y;
            }
        });
        System.out.println(sum);

        //Lambda表达式
       double sum1=getAddSum((x,y)->x+y);
        System.out.println(sum1);
    }
    public static double getAddSum(AddSum addSum){
        double sum=addSum.addS(3.5,9.8);
        return sum;
    }
}
//接口
interface AddSum{
    public abstract double addS(double x,double y);
}
